﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Easyui扩展库 消息Show - 落阳 整理</title>
    <link href="http://www.easyui-extlib.com/Content/Site.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery/jquery-1.11.0.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-extensions/jquery.jdirk.js"></script>
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>

    <script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/messager/jeasyui.extensions.messager.show.js"></script>
    <script>
        $(function () {
            var checkTopMessagerJs = function () {
                var topHead = top.$("head"),
                    existHeadContent = topHead.html(),
                    exist = $.string.contains(existHeadContent, "jeasyui.extensions.messager.show.js");

                return exist;
            };

            var checkTopMessagerJsAndAlert = function () {
                if (!checkTopMessagerJs()) { alert("尚未在顶级window中添加对 messager 扩展的引用，请点击红字中的按钮添加引用。"); return false; }
                return true;
            };

            $("#btnAppendMessagerJsToTop").click(function () {
                if (checkTopMessagerJs()) {
                    alert("已经添加 messager 扩展的引用，无需重复添加。");
                } else {
                    var jsUrl = "/Scripts/jquery-easyui-extensions/messager/jeasyui.extensions.messager.show.js";
                    top.$.util.loadJs(jsUrl);
                    alert("messager 扩展的引用添加成功。");
                }
            });

            $("#btnShow1").click(function () {
                $.messager.show("唱歌");
            });

            $("#btnShow2").click(function () {
                $.messager.show({ msg: "唱歌", title: "青蛙请你", timeout: 0 });
            });

            $("#btnShow3").click(function () {
                $.messager.show({ msg: "唱歌", title: "青蛙请你", position: "bottomLeft" });
            });

            $("#btnShow4").click(function () {
                $.messager.show({ msg: "唱歌", title: "青蛙请你", position: "topRight" });
            });

            $("#btnShow5").click(function () {
                $.messager.show({ msg: "唱歌", title: "青蛙请你", position: "center" });
            });

            $("#btnShow11").click(function () {
                if (!checkTopMessagerJsAndAlert()) { return; }
                $.easyui.messager.show("唱歌");
            });

            $("#btnShow22").click(function () {
                if (!checkTopMessagerJsAndAlert()) { return; }
                $.easyui.messager.show({ msg: "唱歌", title: "青蛙请你", timeout: 0 });
            });

            $("#btnShow33").click(function () {
                if (!checkTopMessagerJsAndAlert()) { return; }
                $.easyui.messager.show({ msg: "唱歌", title: "青蛙请你", position: "bottomLeft" });
            });

            $("#btnShow44").click(function () {
                if (!checkTopMessagerJsAndAlert()) { return; }
                $.easyui.messager.show({ msg: "唱歌", title: "青蛙请你", position: "topRight" });
            });

            $("#btnShow55").click(function () {
                if (!checkTopMessagerJsAndAlert()) { return; }
                $.easyui.messager.show({ msg: "唱歌", title: "青蛙请你", position: "center" });
            });
        });
    </script>
</head>
<body>
    <div class="easyui-panel" data-options="fit:true,border:false" style="padding:20px;">
        <span style="color:red;font-weight:bold;">注意，若要支持 在顶级window中使用 messager 扩展，那么需要先往顶级window页面添加 messager 扩展的引用，点此<a id="btnAppendMessagerJsToTop" class="easyui-linkbutton">点我</a>进行添加</span>
        <br />
        <div style="border:1px solid red;width:700px; height:350px;padding:15px;">
            <a id="btnShow1" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在当前window中显示提示框，内容“唱歌”</a>
            <br />
            <a id="btnShow2" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在当前window中显示提示框，内容“唱歌”，标题“青蛙请你”</a>
            <br />
            <a id="btnShow3" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在当前window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“左下角”</a>
            <br />
            <a id="btnShow4" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在当前window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“右上角”</a>
            <br />
            <a id="btnShow5" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在当前window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“中间”</a>
            <br />

            <br />
            <br />
            <br />

            <a id="btnShow11" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在顶级window中显示提示框，内容“唱歌”</a>
            <br />
            <a id="btnShow22" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在顶级window中显示提示框，内容“唱歌”，标题“青蛙请你”</a>
            <br />
            <a id="btnShow33" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在顶级window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“左下角”</a>
            <br />
            <a id="btnShow44" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在顶级window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“右上角”</a>
            <br />
            <a id="btnShow55" class="easyui-linkbutton" data-options="iconCls:'icon-spider-man',toggle:true">在顶级window中显示提示框，内容“唱歌”，标题“青蛙请你”，位置为“中间”</a>
            <br />
            <br />
            <span style="font-weight:bold;font-size:22px;margin:35px;">show 方式</span>
        </div>
    </div>
</body>
</html>
